<?php
	require_once('paths.inc');
	require_once(INCLUDE_PATH.'constants.inc');
	require_once('page.inc');
	require_once(DB_PATH.'db.inc');
	
	require_once('security.inc');
	require_once('utils.inc');	
	require_once('time.inc');
			
	session_start();    
	
	/*
	 * aici nu verificam nici o permisie...dar aceasta functie verifica daca e rau platnic
	 * si de aceea trebuie chemata
	 */
	
	check_permissions();  
	
	html_header("LANG_Home", "", "home");
	$id_client = $_SESSION['user_logat']->id_client;
		
	$linkuri = array(LANG_Home => "");
	titlu_pagina($linkuri);
	
    output_error_msg();
    output_notice_msg();
    
	$db = db_connect();
    
    echo output_extra_text(LANG_EXTRA_HOME);
	
	echo "<div align=\"left\" class=\"container\">";
		echo "<table align=\"left\" cellpadding=\"0\" cellspacing=\"0\" border=\"0\">";
			echo "<tr>";
				echo "<td valign=\"top\">";				
					if (has_permission(CT_PERM_COMENZI) && has_permission(CT_PERM_PLATI))
						render_incasari_urgente($id_client, $_SESSION['user_logat']->comenzi_incasat_per_pag);    		
				echo "</td>";
			echo "</tr>";
		echo "</table>";
	echo "</div>";
					
	echo "<div align=\"left\" class=\"container\">";
		echo "<table align=\"left\" cellpadding=\"0\" cellspacing=\"0\" border=\"0\">";
			echo "<tr>";
				echo "<td valign=\"top\">";
				if (has_permission(CT_PERM_COMENZI) && has_permission(CT_PERM_PLATI))
					render_plati_urgente($id_client, $_SESSION['user_logat']->comenzi_plata_per_pag);						
				echo "</td>";
			echo "</tr>";
		echo "</table>";
	echo "</div>";
	
	echo "<div align=\"left\" class=\"container\" id=\"lista_incarcari\">";
		render_comenzi_incarcare_descarcare_urgente($id_client, $_SESSION['user_logat']->comenzi_incarcari_per_pag, CT_ADRESA_COMANDA_INCARCARE, 'lista_incarcari');    		
	echo "</div>";
	
	echo "<div align=\"left\" class=\"container\" id=\"lista_descarcari\">";
		render_comenzi_incarcare_descarcare_urgente($id_client, $_SESSION['user_logat']->comenzi_descarcari_per_pag, CT_ADRESA_COMANDA_DESCARCARE, 'lista_descarcari');						
	echo "</div>";	
		
	echo "<div align=\"left\" class=\"container\">";
	echo "<table align=\"left\" cellpadding=\"0\" cellspacing=\"0\" border=\"0\">";			
			echo "<tr>";

				if (has_permission(CT_PERM_FIRME)) {
					echo "<td valign=\"top\">";
                    	render_last_firms($id_client);
					echo "</td>";
					echo "<td width=\"20\"></td>";                    	
				}				
				echo "<td valign=\"top\">";
					stats_hp($db);	
				echo "</td>";
			echo "</tr>";
		echo "</table>";
	echo "</div>";
	html_footer();
?>